﻿@model LogModel
@{
	Html.AddScriptParts("https://cdn.rawgit.com/google/code-prettify/master/loader/run_prettify.js");
	ViewBag.Title = T("Admin.System.Log.ViewLogDetails").Text;
}

@using (Html.BeginForm())
{
    <div class="section-header">
        <div class="title">
            <i class="fa fa-fire"></i>
            @T("Admin.System.Log.ViewLogDetails") @Html.ActionLink("(" + T("Admin.System.Log.BackToList") + ")", "List")
        </div>
        <div class="options">
            <button type="submit" id="log-delete" class="btn btn-danger">
				<i class="far fa-trash-alt"></i>
				<span>@T("Admin.Common.Delete")</span>
			</button>
        </div>
    </div>
    
    <table class="adminContent">
        <tr>
            <td class="adminTitle">
                @Html.SmartLabelFor(model => model.LogLevel)
            </td>
            <td class="adminData">
				<div class="form-control-plaintext">
					<span class="badge badge-@Model.LogLevelHint">@Model.LogLevel</span>
				</div>
			</td>
        </tr>
		<tr>
			<td class="adminTitle">
				@Html.SmartLabelFor(model => model.Logger)
			</td>
			<td class="adminData">
				@Html.TextBoxFor(model => model.Logger, new { @readonly = "readonly", @class = "form-control-plaintext" })
			</td>
		</tr>
        <tr>
            <td class="adminTitle">
                @Html.SmartLabelFor(model => model.ShortMessage)
            </td>
            <td class="adminData">
				<div class="form-control-plaintext">
					@Html.TextAreaFor(model => model.ShortMessage, new { @readonly = "readonly" })
				</div>
            </td>
        </tr>
        <tr>
            <td class="adminTitle">
                @Html.SmartLabelFor(model => model.IpAddress)
            </td>
            <td class="adminData">
				@Html.TextBoxFor(model => model.IpAddress, new { @readonly = "readonly", @class = "form-control-plaintext" })
            </td>
        </tr>
        <tr>
            <td class="adminTitle">
                @Html.SmartLabelFor(model => model.CustomerId)
            </td>
            <td class="adminData">
                @if (Model.CustomerId.HasValue)
				{
					<div class="form-control-plaintext">
						@Html.ActionLink(!String.IsNullOrEmpty(Model.CustomerEmail) ? Model.CustomerEmail : T("Admin.Customers.Guest").Text, "Edit", "Customer", new { id = Model.CustomerId }, new { })
					</div>
				}
			</td>
        </tr>
		<tr>
			<td class="adminTitle">
				@Html.SmartLabelFor(model => model.UserName)
			</td>
			<td class="adminData">
				@Html.TextBoxFor(model => model.UserName, new { @readonly = "readonly", @class = "form-control-plaintext" })
			</td>
		</tr>
        <tr>
            <td class="adminTitle">
                @Html.SmartLabelFor(model => model.PageUrl)
            </td>
            <td class="adminData wide">
				@if (Model.PageUrl.HasValue())
				{
					<div class="form-control-plaintext">
						<span>@Model.HttpMethod </span>
						<a href="@Model.PageUrl" target="_blank">@Model.PageUrl</a>
					</div>
				}
			</td>
        </tr>
        <tr>
            <td class="adminTitle">
                @Html.SmartLabelFor(model => model.ReferrerUrl)
            </td>
            <td class="adminData wide">
				@if (Model.ReferrerUrl.HasValue())
				{
					<div class="form-control-plaintext">
						<span>@Model.HttpMethod </span>
						<a href="@Model.ReferrerUrl" target="_blank">@Model.ReferrerUrl</a>
					</div>
				}
            </td>
        </tr>
        <tr>
            <td class="adminTitle">
                @Html.SmartLabelFor(model => model.CreatedOn)
            </td>
            <td class="adminData">
				<div class="form-control-plaintext">
					@Html.DisplayFor(model => model.CreatedOn)
				</div>
            </td>
        </tr>
        @if (Model.FullMessage.HasValue())
        {
            <tr>
                <td class="adminTitle">
                    @Html.SmartLabelFor(model => model.FullMessage)
                </td>
                <td class="adminData wide">
					@*No whitespace within pre tag*@
					<pre class="prettyprint xlang-java" style="white-space: pre-wrap;">@Html.DisplayFor(model => model.FullMessage)</pre>
                </td>
            </tr>
        }
    </table>
}

@Html.DeleteConfirmation("log-delete")
